package com.ziq.zcamp.bean.post

import com.blankj.utilcode.util.GsonUtils
import com.ziq.zcamp.proguard.ProguardKeep
import java.io.Serializable

class Post : ProguardKeep, Serializable {
        var post_id :String? = null
        var p_type : Int? = null //帖子类型 1动态(默认) 2视频 3文章
        var title :String? = null
        var content :String? = null
        var pictures :String? = null
        var publish_time :String? = null
        var location_addr :String? = null
        var longitude :String? = null
        var latitude :String? = null
        var camping_start_time: Long? = null  //露营日开始时间戳 秒
        var camping_end_time: Long? = null  //露营日结束时间戳 秒
        var topic_names :String ?= null

        var comment_nums : Int? = null


        //帖子中的话题
        var like_nums : Int? = null
        var is_like: Boolean? = null


        var images : List<ImageInfo>? = null
        var topicList : List<String>? = null

        fun parseData(){
                var imageList: List<ImageInfo> =  mutableListOf<ImageInfo>()
                if (pictures?.isNotEmpty() == true){
                        pictures?.let {
                                imageList = GsonUtils.fromJson(it, GsonUtils.getListType(
                                        ImageInfo::class.java))
                        }
                }
                images = imageList
                topic_names?.let {
                        topicList = it.split(",").toList()
                }
        }
}